<template>
  <el-dialog title="拉群设置" :visible.sync="$attrs.visableIf" @close="handleCloseDialog" :close-on-click-modal="false" :close-on-press-escape="false" append-to-body width="750px">
    <el-form ref="form" :rules="rules" :model="form" label-width="120px">
      <div class="tips">
        <p>1、客户群人数多于40人后，需要发送群邀请链接，客户确认后才能进群；已在群中的客户不会重复邀请；</p>
        <p>2、每个群邀请入群的人数=群人数上限-该群当前群成员人数；</p>
      </div>
      <el-form-item label="客户群：" prop="name">
       <el-button icon="el-icon-plus" size="small">添加客户群</el-button>
      </el-form-item>
      <el-form-item label="群人数上限：" prop="name">
        <el-input v-model="form.number"  type="number" size="small" :min="40" style="width: 80px;margin: 0px 10px"></el-input>
      </el-form-item>
      <el-form-item label="自动新建群：" prop="name">
        <el-switch v-model="form.lowFreqAutoStop"></el-switch>
      </el-form-item>
      <el-form-item label="群名称：" prop="name">
        <el-input  placeholder="请输入群名称" size="small" style="width:200px"></el-input>
        群自动编号，从<el-input  type="number" placeholder="编号" size="small" style="width:80px;margin: 0px 5px"></el-input>开始
         <div class="sort">举例：群名称“团购群”，编号从3开始。则新建群的名称为“团购群3”“团购群4”“团购群5”…</div>
      </el-form-item>
    </el-form>
    <div class="footer-btn" slot="footer">
      <el-button type="primary" @click="handleCloseDialog">取消</el-button>
      <el-button @click="onSubmit('form')">确定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'groupSettings',
  components: {
  },
  data() {
    return {
      form: {
        type: [],//分组集合
      },
      rules: {
        'chooseGroup': [
          {required: true, message: '请选择分组', trigger: 'change'}
        ],

      },
    }
  },
  created() {
  },
  mounted() {
  },
  watch: {
    'form.number'(val){
      if(val<40){

      }
    }
  },
  methods: {
    onSubmit(formName) {
      //提交的代码
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log('提交表单');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    handleCloseDialog() {
      this.$emit('update:visableIf', false);
      this.$emit('handleQuery');
    }
  }
}
</script>

<style scoped lang="scss">
.tips {
  line-height: 20px;
  background-color: #f0f7ff;
  border: 1px solid #abceff;
  padding: 8px 15px;
  margin-bottom: 20px;
  p{
    padding: 0px;
    margin: 0px;
  }
}

::v-deep .el-form-item {
 .el-form-item__content {
    margin-left: 0px !important;
  }
}
.sort {
  color: rgba(0, 0, 0, .45);
}
</style>
